-
Notifications
You must be signed in to change notification settings - Fork 89
Allow stream.{read,write}s of length 0 to query/signal readiness #444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
d9516ae
to
d02e83b
Compare
d02e83b
to
82c2ef6
Compare
Updated the PR based on further discussion in #441 about what happens when a |
cc @dicej on this as it relates to our discussion this morning. It looks like the wasip3-prototyping branch doesn't implement the spec as-is as 0-length reads/writes aren't trapped, and it also hasn't been updated to take this PR into account either. Basically I think wasip3-prototyping is an ambiguous state right now as to what 0-length reads/writes mean. Also question for you @lukewagner. The topic of 0-length reads/writes have come up in the context of figuring out what the result of an async stream operation is. Specifically I was attempting to model the result of a stream operation as a tri-state value of either (a) completed with N items, (b) closed, or (c) cancelled. Given the way the return codes map here though is it correct to say that if you cancel a 0-length operation there's no way to figure out what happened as a result? The canonical ABI code returned will be 0, maybe eventually, and that's ambiguous whether the read/write was cancelled or "completed"? |
You're right, as currently written, after a |
This PR relaxes the rules for
stream.{read,write}
to accept lengths of0
. This can be useful for signalling and querying readiness which in turn can be used to implement non-blocking POSIX operations, as discussed in #441.